import { createRouter, createWebHashHistory } from 'vue-router' 
import Home from '../views/Home.vue'
//配置路由的规则
let routes = [
    {
        path: '/',
        name: 'home',
        component: Home
    },
    {
        path: '/find',
        name: 'find',
        //直接导入组件，懒加载方式
        component: () => import('../views/Find.vue'),
        //二级路由配置，嵌套路由
        children: [
            {
                path: 'toplist',
                name: 'toplist',
                component: () => import('../views/Toplist.vue'),
                // children:[]
            },
            {
                path: 'playlist',
                name: 'playlist',
                component: ()=> import('../views/Playlist.vue')
            }
        ]
    },
    {
        path: '/my',
        name: 'my',
        //直接导入组件，懒加载方式
        component: () => import('../views/My.vue')
    },
    {
        path: '/friend',
        name: 'friend',
        //直接导入组件，懒加载方式
        component: () => import('../views/Friend.vue')
    }
]
// 创建路由对象
const router = createRouter({
    history: createWebHashHistory(),
    routes

})
// 导出路由对象 因为需要全局配置
export default router;